package com.explment.lens.utils.result;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 分页工具类 封装返回格式
 */
public class PageUtils {
    public static <T> PageResult<T> convert(Page<T> page) {
        PageResult<T> result = new PageResult<>();
        result.setCurrent((int) page.getCurrent());
        result.setSize((int)page.getSize());
        result.setTotal((int)page.getTotal());
        result.setPages((int)page.getPages());
        result.setRecords(page.getRecords());
        return result;
    }
}
